package com.itheima.dao;

import com.itheima.controller.UserOperator;
import com.itheima.pojo.User;
import com.itheima.util.XmlParserUtils;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: Bytezero_zhengLei
 * @Date: 2024/6/24 15:19
 * @Project_Name:
 * @Email: 420498246@qq.com
 * @Description:
 * @TODO:
 */

@Repository
//持久层   访问数据
public class UserDao implements UserDaoimp{
    // 1. 解析xml文件, 获取数据
    // 获取xml文件的相对路径
    public List<User> getUserDataList() {
        String path = UserOperator.class.getClassLoader().getResource("user.xml").getPath();
        List<User> userList = XmlParserUtils.parse(path);
        return userList;
    }

}
